Repository navigation
feat(runtime): add document lifecycle commands and exact-byte persistence path - #2
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84379cb7f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not document then | ||
| return false, "no active document" | ||
| end | ||
| return runtime:_close_document(document.id, false) |
There was a problem hiding this comment.
Check dirty state before closing a document
When a document has unsaved edits, invoking this new command (including the newly bound Ctrl+W) unconditionally closes its Kernel handle and removes its views; no dirty-state check or confirmation runs, so the only canonical copy of those edits is discarded without a save/cancel choice. Guard dirty closes with a confirmation or explicit discard path rather than closing immediately.
AGENTS.md reference: AGENTS.md:L8-L9
Useful? React with 👍 / 👎.
| -- FE-016 / PROTO-041: default editing shortcuts are Runtime policy. The | ||
| -- Frontend emits raw key events and never duplicates or interprets bindings. | ||
| runtime.keymap:bind("ctrl+n", "document.new", { owner = "core" }) | ||
| runtime.keymap:bind("ctrl+s", "document.save", { owner = "core" }) |
There was a problem hiding this comment.
Surface a missing save capability on Ctrl+S
For a path-backed document on a Host without begin_atomic_write, document.save is filtered out by its available predicate before Saver:save can raise UNSUPPORTED, so this new Ctrl+S binding returns unhandled instead of the documented unsupported-capability error. Keep the command executable when the writer is absent so it can return UNSUPPORTED, or surface that typed result from the binding.
Useful? React with 👍 / 👎.
Summary
Add the Runtime-owned document lifecycle needed by a live Frontend session while keeping all command/keymap policy in Runtime and all file I/O in the optional Backend Host service.
Changes
document.new,document.openanddocument.closecommands.host.fs.read_file; absence fails closed withUNSUPPORTED.view_idfocus centrally before UI publication for both explicit commands and keymap dispatch.IO_ERRORidentity in Runtime's structured error vocabulary.Baseline
This branch starts from the exact Runtime revision previously pinned by CDIN
deps.lock(762aba7d5674149cae3a8f736d93159360fff730) rather than importing unrelated current-main changes.Verification
CDIN now pins this tested Runtime head together with the merged Frontend TUI package and Backend 1.0.2. The headless CDIN document workflow is implemented and passed Linux pinned-stack E2E plus Linux ASan/UBSan/leak detection in CI run 42073127614; current-head macOS/Windows verification is still pending. This CDIN smoke does not replace FE-019 TUI readiness or rendering tests.